
#使用到的系统库
#--1.PyQt库
import sys
from PySide6.QtWidgets import QApplication,QMainWindow
from PySide6 import QtCore, QtGui, QtWidgets
from PySide6 import QtCore, QtGui, QtWidgets,QtPrintSupport
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import   QApplication,QMainWindow,QFileDialog,QPushButton,QMessageBox
from PySide6.QtWidgets import QApplication, QMainWindow, QTextEdit, QPushButton, QVBoxLayout, QWidget
#from asyncio.windows_events import NULL
#--2.Excel与Word库
#import xlrd
#import xlwt
import os
import sqlite3

from numpy import number
#from docx  import Document
#from docx.shared import Pt,RGBColor
#from docx.oxml.ns import qn
#import openpyxl
#--3.自定义库
import db
import face.loginface
import face.mainwindows_ui
import face.xuanzetiface_ui
import face.zuoti_ui
#import face.f
#import loginface 
#--4.其他库
import random
import csv
import _warnings
#import paho.mqtt.client as mqtt

class loginWindow(QMainWindow):
    flag = 1
    def __init__(self):
        super().__init__()
        self.ui = face.loginface.Ui_MainWindow()
        self.ui.setupUi(self)
        #透明
        self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
        self.setAttribute(QtCore.Qt.WA_TranslucentBackground)

        #阴影
        self.shadow = QtWidgets.QGraphicsDropShadowEffect(self)
        self.shadow.setOffset(5,5)
        self.shadow.setBlurRadius(10)
        self.shadow.setColor(QtCore.Qt.black)
        #self.ui.frame.setGraphicsEffect(self.show)
        self.ui.label.setGraphicsEffect(self.shadow)
        #self.label_2.setPixmap(QtGui.QPixmap("school.jpg"))
        self.show()

    def state(self):
        return self.flag
    
    def emit(self):
        try:
            flag = 0
            self.win = Mainwindows()
            #self.win.getnumbernae(int(number),name)
            if self.win.getnumbernae(1) == 1:
                self.win.show()
                self.close()
                print("ok")
        except:
            pass
            print("出错啦")

class Mainwindows(QMainWindow):
    flag = 1
    number = 0
    def __init__(self):
        super().__init__()
        self.ui = face.mainwindows_ui.Ui_MainWindow()
        #self.verticalLayout_2.setObjectName("mainLayout_2")
        
        self.ui.setupUi(self)
        #self.verticalLayout_2.addWidget(self.pushButton_8)
        #self.show()#此项自动启动
    
    def getnumbernae(self,number):
        print (number)
        self.number = number
        return 1
    
    def button01(self):

        self.xuanzetiface = ZuoTiMokuai()
        self.form = From()
        self.ui.tabWidget.addTab(self.xuanzetiface ,"hahhah")
        self.ui.tabWidget.addTab(self.form,"form")
        self.ui.widget.add(self.form)
        #self.tabWidget.setCurrentINDEX(1)
        print("button01 is pudown")
        pass

class From(QWidget):
    def __init__(self):
        super().__init__()
        self.ui = face.zuoti_ui.Ui_Form()
        self.ui.setupUi(self)
        
class ZuoTiMokuai(QWidget):
    def __init__(self):
        super().__init__()#alignment=Qt.AlignLeft | Qt.AlignBottom
        self.ui = face.xuanzetiface_ui.Ui_xuanzetiface()#Ui_xuanzetiface
        self.ui.setupUi(self)

if __name__ == "__main__":
    app =QApplication(sys.argv)
    win = loginWindow()
    sys.exit(app.exec_())
